from problems import parse_problem
import graphic_problems_2
from astar_solution import astar_solution
from heuristics import  manhattan_dirt
import matplotlib.pyplot as plt
from numpy import arange

problems = {}
lengths = []
indexes = []

for (k,p) in graphic_problems_2.p.items():
    p_ = parse_problem(p)
    t,s=astar_solution(manhattan_dirt()).solve(p_)
    problems[s] = k
    lengths.append(s)

lengths.sort()
print lengths

ax = plt.subplot(111)

width = 0.15  
bars={}
i = 0

for l in lengths:
    bars[l]= plt.bar(i, l, width)
    indexes.append(problems[l])
    i += 1

ind = arange(len(lengths))
ax.set_xticks(ind+width)
ax.set_xticklabels(indexes)

plt.show()
